public class Demo3 {
    public  static  int j = 0;
    public static void main(String[] args) throws InterruptedException {


        Thread t = new Thread(() -> {
            while (j < 3) {

                System.out.println("hello thread");
                j++;
//                System.out.println(Thread.currentThread().isDaemon());
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
        });

//        t.setDaemon(true);
        t.start();
//        int i = 0;
        while (true) {
            System.out.println("hello main");
            Thread.sleep(1000);
            System.out.println(t.isAlive());

        }
//        System.out.println("结束进程");

    }

}
